import Vue from 'vue'
import VueRouter from 'vue-router'
import Home from '../views/index/HeadPage.vue'

Vue.use(VueRouter)

const routes = [
  {//这里是首页
    path: '*',
    name: '404',
    redirect:'/home/lietou',
    meta:{
      title:"医疗专业人才_麟越医生"
    }
  },
  {//这里是首页
    path: '/',
    name: 'home',
    redirect:'/home/lietou',
    meta:{
      title:"医疗专业人才_麟越医生"
    }
  },
  {//这里是首页
    path: '/home',
    name: 'home',
    component: Home,
    meta:{
      title:"医疗专业人才_麟越医生"
    },
    children:[{
      name: "hot",
      path: "hot",
      component: () => import('../components/renmen/LingYueLieTou.vue'),
      meta:{
        title:"医疗专业人才_麟越猎头"
      }
      },
      {
        name: "toutiao",
        path: "toutiao",
        component: () => import('../components/renmen/PinTouTiao.vue'),
        meta:{
          title:"医疗专业人才_聘头条"
        }
      },
      {
        name: "lietou",
        path: "lietou",
        component: () => import('../components/renmen/ReMenZhaopin.vue'),
        meta:{
          title:"医疗专业人才_热门招聘"
        }
      },
  ]
    
  },
   {//这里是职位
    path: '/position',
    name: 'position',
    component: () => import('../views/position/PosTion.vue'),
    meta:{
      title:"医疗专业人才_职位"
    },

    children:[{//职位
      name: "zhiw",
      path: "zhiw",
      component: () => import('../components/renmen/LingYueLieTou.vue'),
      meta:{
        title:"医疗专业人才"
      }
    },
    {//聘头条
    name: "tout",
    path: "tout",
    component: () => import('../components/renmen/PinTouTiao.vue'),
    meta:{
      title:"医疗专业人才_招聘岗位"
    }
  },]
  },
    {//这里是头条
      path: '/headline',
      name: 'headline',
      component: () => import('../views/headline/HeadLine.vue'),
      meta:{
        title:"医疗专业人才_头条"
      }
    },
   {//这里是简历
    path: '/resume',
    name: 'resume',
    component: () => import('../views/resume/ResuMe.vue'),
    meta:{
      title:"医疗专业人才_头条"
    },
    children:[{//触发登录页面
      name: "login",
      path: "login",
      component: () => import('../components/xiaozujian/LoGin.vue')
    },]
  },
  {//这里是我的
    path: '/myself',
    name: 'myself',
    component: () => import('../views/MySelf/MySelf.vue'),
    meta:{
      title:"医疗专业人才_我的"
    },
  },
  {//编辑简历1
    name: "addresume",
    path: "/addresume",
    component: () => import('../components/resumezujian/JiBenXinXi.vue'),
    beforeEnter: (to, from, next) => {
    let token =  window.localStorage.getItem("token")
      if(token){
        next()
      }else{
        next("resume/login")
      }
    }

  },
  {//编辑简历1
    name: "jobintention",
    path: "/jobintention",
    component: () => import('../components/resumezujian/YiXiangContent.vue'),
    beforeEnter: (to, from, next) => {
      let token =  window.localStorage.getItem("token")
        if(token){
          next()
        }else{
          next("myself")
        }
      }
  },
  // {//触发登录页面
  //   name: "login",
  //   path: "/login",
  //   component: () => import('../components/xiaozujian/LoGin.vue')
  // }
  // {
  //   path: '/about',
  //   name: 'about',
  //   // route level code-splitting
  //   // this generates a separate chunk (about.[hash].js) for this route
  //   // which is lazy-loaded when the route is visited.
  //   component: () => import(/* webpackChunkName: "about" */ '../views/AboutView.vue')
  // }
]
const router = new VueRouter({
  mode: 'hash',
  base: process.env.BASE_URL,
  routes
})

export default router
